package schemas

import (
	"github.com/gin-gonic/gin"
)

type CreateUser struct {
	Username string `json:"username" form:"username" binding:"required" comment:"用户名"`
	Nickname string `json:"nickname" form:"nickname" binding:"required" comment:"昵称"`
	Password string `json:"password" form:"password" binding:"required" comment:"密码"`
	Confirm  string `json:"confirm" form:"confirm" binding:"required" comment:"确认密码"`
}

func (s *CreateUser) BindValidParam(ctx *gin.Context) error {
	return DefaultGetValidParams(ctx, s)
}

type UpdateUser struct {
	Username string `json:"username" form:"username" binding:"required" comment:"账号"`
	Nickname string `json:"nickname" form:"nickname" binding:"required" comment:"昵称"`
}

func (s *UpdateUser) BindValidParam(ctx *gin.Context) error {
	return DefaultGetValidParams(ctx, s)
}

type UpdateUserPassword struct {
	ID          uint   `json:"id" form:"id" binding:"required" comment:"用户ID"`
	OldPassword string `json:"old_password" form:"old_password" binding:"required" comment:"旧密码"`
	Password    string `json:"password" form:"password" binding:"required" comment:"密码"`
	Confirm     string `json:"confirm" form:"confirm" binding:"required" comment:"确认密码"`
}

func (s *UpdateUserPassword) BindValidParam(ctx *gin.Context) error {
	return DefaultGetValidParams(ctx, s)
}

type ResetPassword struct {
	ID       uint   `json:"id" form:"id" binding:"required" comment:"用户ID"`
	Password string `json:"password" form:"password" binding:"required" comment:"密码"`
	Confirm  string `json:"confirm" form:"confirm" binding:"required" comment:"确认密码"`
}

func (s *ResetPassword) BindValidParam(ctx *gin.Context) error {
	return DefaultGetValidParams(ctx, s)
}
